-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Fix configuration cache compatibility issues #124073
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix configuration cache compatibility issues #124073
Conversation
breskeby
commented
Mar 5, 2025
- for running :plugins:discovery-ec2:check
- checking if in idea in build scan background action
- for running :plugins:discovery-ec2:check - checking if in idea in build scan background action
|
Pinging @elastic/es-delivery (Team:Delivery) |
| } | ||
| } else { | ||
| tag 'LOCAL' | ||
| if (providers.systemProperty('idea.active').present) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
when running with configuration cache enabled, Project#providers is not available from a build scan background action. we can fall back to normal System.getProperty check instead as gradle instruments System.getProperty calls automatically to take into account for configuration caching.
| final File javaPolicy = new File(layout.buildDirectory.asFile.get(), "tmp/java.policy") | ||
| outputs.file(javaPolicy) | ||
| doLast { | ||
| final File tmp = file("${buildDir}/tmp") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the Project#file utility method and the buildParams extension are not available from task execution phase (e.g. running in doLast) when configuration cache enabled.
We moved declaring the output file and the inFips boolean into the configuration phase and also declared them as proper inputs/outputs for the writeTestJavaPolicy task to mark it properly as up-to-date on unchanged reruns.
Some background on this: https://docs.gradle.org/current/userguide/configuration_cache.html#config_cache:requirements
| // this is needed to manipulate com.amazonaws.sdk.ec2MetadataServiceEndpointOverride system property | ||
| // it is better rather disable security manager at all with `systemProperty 'tests.security.manager', 'false'` | ||
| if (buildParams.inFipsJvm){ | ||
| nonInputProperties.systemProperty 'java.security.policy', "=file://${buildDir}/tmp/java.policy" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Project#buildDir is a deprecated and will be removed at one point
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the detailed explanation. It is helpful.
LGTM
- for running :plugins:discovery-ec2:check - checking if in idea in build scan background action
- for running :plugins:discovery-ec2:check - checking if in idea in build scan background action
- for running :plugins:discovery-ec2:check - checking if in idea in build scan background action
- for running :plugins:discovery-ec2:check - checking if in idea in build scan background action
- for running :plugins:discovery-ec2:check - checking if in idea in build scan background action
- for running :plugins:discovery-ec2:check - checking if in idea in build scan background action